-- msg_offline_bonus
-- Create by panyl
-- 通知离线战斗奖励

return function(lpc)
    local id = lpc.id
    local lastTime = lpc.last_time
    local bonus = {}

    -- 把奖励解析出来
    for key, value in pairs(lpc.bonus) do
        if type(key) == "number" then
            table.insert(bonus, {1, key, value})
        elseif type(key) == "string" then
            table.insert(bonus, {2, key, value})
        end
    end
    
    -- 保存
    CombatM.setOfflineBonus({["id"] = id, ["offline_time"] = lastTime, ["bonus"] = bonus, })
    
    -- 抛出事件就行了
    EventMgr.fire(event.OFFLINE_BONUS, {["id"] = id, ["offline_time"] = lastTime, ["bonus"] = bonus, });
end
